package com.ftg.learn.bus.control_list.control_list_mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ftg.learn.bus.control_list.control_list_pojo.control_list;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface control_list_mapper extends BaseMapper<control_list> {

    @Select("select cl.*,ma.menu_name from control_list cl " +
            "LEFT JOIN menu_admin ma ON cl.control=ma.menu_id where role_id=#{role_id}")
    List<Map<String,Object>> query(String role_id);

    @Insert("insert into control_list(control_id,role_id,control) values (#{control_id},#{role_id},#{control})")
    int insert(control_list control_list);

    @Delete("delete from control_list where role_id=#{role_id}")
    int delete(String role_id);
}
